#Given an array of integers, 
#every element appears twice except for one. Find that single one.
class Solution:
    # @param A, a list of integer
    # @return an integer
    def singleNumber(self, A):
        A.sort()
        for i in range(1, len(A), 2):
            if A[i] != A[i-1]: # 与前一元素对比
                return A[i-1]
        return A[-1] # 要找的元素是最后一个元素
